2022 |
您所在的位置:网站首页 › java warmup › 2022 |
The minimum number of operations is $$$T=\lceil log_2(K) \rceil$$$. To print a solution, consider a $$$100 \times 100$$$ grid that have the numbers from $$$0$$$ to $$$K-2$$$ written on the first $$$K-1$$$ cells of the rows with odd index (except in the last column) and the rest of cells have written $$$2^T-1$$$ on them. For example, for $$$K=102$$$: The idea is to use the machine during the $$$i$$$-th operation on the cells that have the $$$i$$$-th bit set. Every cell is adjacent to at least one cell with the number $$$2^T-1$$$, so the cells used during each operation will form a connected component, and we will have $$$K$$$ types at the end. |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |